package com.cskaoyan.service;

import com.cskaoyan.bean.GoodsToTopic;
import com.cskaoyan.exception.GoodsToTopicException;
import com.cskaoyan.mapper.GoodsToTopicMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author lxy
 * @create 2021-10-20 10:39
 */
@Service
public class GoodsToTopicServiceImpl implements GoodsToTopicService {

    @Autowired
    GoodsToTopicMapper goodsToTopicMapper;

    @Override
    public GoodsToTopic getTopicGoods(Integer goodsId) throws GoodsToTopicException {

        GoodsToTopic goodsToTopic = goodsToTopicMapper.selectByPrimaryKey(goodsId);
        if (goodsToTopic == null) throw new GoodsToTopicException();

        return goodsToTopic;
    }
}
